//
//  MYComposeButton.swift
//  MYWeibo
//
//  Created by Magic Yu on 16/4/22.
//  Copyright © 2016年 Magic Yu. All rights reserved.
//

import UIKit

let imageW: CGFloat = 80

class MYComposeButton: UIButton {
    
    var composeItem: MYComposeItem? {
        didSet {
        setTitle(composeItem?.title, forState: .Normal)
            setImage(UIImage(named: composeItem?.icon ?? ""), forState: .Normal)
        }
    }

    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: imageW, height: imageW)
    }
    
    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: imageW, width: imageW, height: contentRect.height - imageW)
    }

}
